package com.liyy.platform.other.listener_event.listener;

import com.liyy.platform.other.listener_event.event.MyEvent;
import org.apache.log4j.Logger;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * Created by liyy on 2018/8/17.
 * 通过@EventListener注解实现事件监听
 */
@Component
public class MyListener4 {
    Logger logger = Logger.getLogger(MyListener4.class);

    @EventListener
    public void listener(MyEvent event)
    {
        logger.info(String.format("%s监听到事件源：%s.", MyListener4.class.getName(), event.getSource()));
    }
}
